package org.loneranger.p1_get_bean.demo;

import org.loneranger.p1_get_bean.config.MyComponentConfig;
import org.loneranger.p1_get_bean.bean.MyDog;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


/**
 * 通过注解@Component 和 @ComponentScan 获取bean
 *
 * @author loneranger
 */
public class ComponentBeanTest {

	public static void main(String[] args) {

		AnnotationConfigApplicationContext applicationContext =
				new AnnotationConfigApplicationContext(MyComponentConfig.class);
		MyDog myDog = applicationContext.getBean(MyDog.class);
		myDog.wang();

	}

}
